﻿@inherits Vowei.Web.G18nWebViewPage
@using System.Web.Mvc.Html 
@using Vowei.Web.Helpers

@{
    ViewBag.Title = string.Format(T("管理用户组 [{0}]"), ViewBag.RoleName);
}

<h2>@T("管理用户组")</h2>

<form method="post" action="/Role/Edit">
    @* TODO: 因为ASP.NET没有提供修改用户组名称的API,需要自己编写SQL语句修改用户名
    <div class="editor-label">
		名称
    </div>
    *@
    <div class="editor-field">
		<input type="hidden" name="OriginalRoleName" value="@ViewBag.RoleName" id="OriginalRoleName" />
		<input type="hidden" name="RoleName" value="@ViewBag.RoleName" id="RoleName" />
    </div>

    <fieldset>
       <legend>@string.Format(T("用户组[{0}]的权限"), ViewBag.RoleName)</legend>

       <div class="editor-field">
       @foreach (var item in ViewBag.Permissions)
       {
           var isChecked = item.Value ? "checked" : "";
       
           <input type="checkbox" value="@item.Key.ID" @isChecked name="Permission" id="Permission" /> @item.Key.Title <br />
       }
       </div>
    </fieldset>

    <p>
        <input type="submit" value="修改用户组信息" />
    </p>
</form>

<form method="post" action="/Role/RemoveUser">
    <fieldset>
        <legend>管理用户组[@ViewBag.RoleName] 里面的用户</legend>
		<input type="hidden" name="RoleName" value="@ViewBag.RoleName" />
        <div class="editor-label">
        @foreach (var user in ViewBag.Users)
        {
            <input type="checkbox" id="UserEmails" name="UserEmails" value="@user" />@user <br />
        }
        </div>
        <p>
            <input type="submit" value="删除" />
        </p>
    </fieldset>
</form>

<div>
   <a href="/Role/AddUser/?role=@Url.Encode(@ViewBag.RoleName)">@T("向用户组里添加新用户")</a>
</div>
